import 'package:flutter/material.dart';
import 'checkbox_demo.dart';
import 'radio_demo.dart';
import 'slide_demo.dart';
import 'switch_demo.dart';
import 'datetime_demo.dart';

class InputListViewDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return InputListView();
  }
}

class InputListView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ListView(
      children: <Widget>[
        InputListViewItem(
          title: 'CheckboxDemo',
          page: CheckBoxDemo(),
        ),
        InputListViewItem(
          title: 'RadioDemo',
          page: RadioDemo(),
        ),
        InputListViewItem(
          title: 'SlideDemo',
          page: SlideDemo(),
        ),
        InputListViewItem(
          title: 'SwitchDemo',
          page: SwitchDemo(),
        ),
        InputListViewItem(
          title: 'DateTimeDemo',
          page: DateTimeDemo(),
        ),
      ],
    );
  }
}

class InputListViewItem extends StatelessWidget {
  final String title;

  final Widget page;

  InputListViewItem({this.title, this.page});

  @override
  Widget build(BuildContext context) {
    return ListTile(
      title: Text(title),
      onTap: () {
        Navigator.of(context)
            .push(MaterialPageRoute(builder: (context) => page));
      },
    );
  }
}
